#pragma once
                   
#include <limits.h>


class CCmdlineArgs
{   
public:
    CCmdlineArgs();
    ~CCmdlineArgs() { Cleanup(); }

    void Init(const char *cmdline);
    void Init(int pargc, const char *pargv[]);
    void Cleanup();

    bool Check(const char *arg) const   { return Find(arg) > 0; }
    const char *GetValue(const char *arg, const char *default_value) const;
    int GetIntValue(const char *arg, int default_value, int minvalue=INT_MIN, int maxvalue=INT_MAX) const;

    int GetSize() const { return argc; }
    const char *GetAt(int i) const { return i >= 0 && i < argc ? argv[i] : 0; }
    
private:
    int Find(const char *arg) const;

private:
    int    argc;
    char **argv;
};
